package com.wangsd;


import com.alibaba.fastjson.JSON;
import org.junit.platform.commons.util.StringUtils;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class Java8Tester {
    public static void main(String args[]) {
        String str = "1,2";
        List<Long> a = Arrays.asList(str.split(",")).stream().map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());
        System.out.println(a);

        System.out.println(JSON.toJSONString(a));

        String c = Arrays.toString(a.toArray());
        System.out.println(c);

        String str2 = "[1,2]";
        List<Long> b = JSON.parseArray(str2, Long.class);
        System.out.println(b);

    }
}
